<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../inc_bootstrap.jsp"></jsp:include>
    <jsp:include page="../head.jsp"/>
    <title>商家管理-渠道管理</title>
	<link rel="stylesheet" href="${ctx}/css/iconfont.css"/>
    <script type="text/javascript">
        $(function(){
            //先销毁表格
            $('#bootTable').bootstrapTable({
                url: '${ctx}/charges/getBuyerList?temp='+Math.random(),
                dataType: "json",
                method: 'get',
                cache: false,
                height: "auto",//
                striped: true,
                pagination: true,
                pageSize: 20,
                pageNumber:1,
                pageList: [10, 20, 50, 100, 200, 500],
                search: true,
                showColumns: true,
                showRefresh: true,
                clickToSelect: true,
                idField:'id',
                //toolbar: "#toolbar",
                paginationHAlign: 'left',
                paginationDetailHAlign: 'right',
                sidePagination: "server", //表示服务端请求
                queryParamsType : "undefined",
                columns: [
                    {field:"id",title:"",align:"left",valign:"middle",sortable:"true",visible:false},
                    {field:"buyerName",title:"采购商",align:"left",valign:"middle"},
                     {field:"orderTimeForWork",title:"机票款保留时长（工作日）",align:"left",valign:"middle",
                     formatter: function(value, row, index) {
                     return CommonConverter.toEmptyString(row.orderTimeForWork);
                     }
                     },
                     {field:"orderTime",title:"机票款保留时长（非工作日）",align:"left",valign:"middle",
                     formatter: function(value, row, index) {
                     return CommonConverter.toEmptyString(row.orderTime);
                     }
                     },
                     {field:"contractTimeForWork",title:"押金保留时长(工作日)",align:"left",valign:"middle",
                     formatter: function(value, row, index) {
                     return CommonConverter.toEmptyString(row.contractTimeForWork);
                     }
                     },
                     {field:"contractTime",title:"押金保留时长(非工作日)",align:"left",valign:"middle",
                     formatter: function(value, row, index) {
                     return CommonConverter.toEmptyString(row.contractTime);
                     }
                     },
                    {field:"isAudit",title:"散客订单审核",align:"left",valign:"middle",
                        formatter: function(value, row, index) {
                            var str='';
                            if(row.isAudit == 0){
                                str ='关闭';
                            }else if(row.isAudit == 1){
                                str='开启';
                            }else{
                                str='未知';
                            }
                            return str;
                        }
                    },
                    {field:"status",title:"操作",align:"center",valign:"middle",
                        formatter: function(value, row, index) {
                            var paymentTime=CommonConverter.toEmptyString(row.paymentOverTime);
                            //var str = '<div class="autoBoxTwo"><span class="mynewBtn" onclick=Editor("'+row.id+'")>编辑</span></div>';
                            var str ='<i class="icon iconfont" title="编辑" onclick=Editor("'+row.id+'")>&#xe601;</i>';
                            return str;
                        }
                    }
                ],
                formatNoMatches: function(){
                    return '无符合条件的记录';
                }
            });
        });

        //编辑
        function Editor(id){
            // alert(id);
            layer.open({
                type: 2,
                title: ['渠道管理','background-color:#00B2EE; color:#fff;'],
                shadeClose: true,
                shade: 0.3,
                yes: function(index, layero) {
                    layer.close(index);
                },
                btn2: function(index, layero) {
                    //取消的回调
                },
                area: ['600px', '400px'],
                content: ['${ctx}/np/toEditChannel?id='+id],  //iframe的url，no代表不显示滚动条
                success: function(layero, index){
                    // layer.full(index);
                },
                end:function(){
                    $('#bootTable').bootstrapTable('refresh',{url: '${ctx}/charges/getBuyerList?temp='+Math.random()});
                }
            });
        }

    </script>
</head>
<body style="padding-left:10px;" >
<div class="divBox">
    <table id="bootTable" class="table-striped"></table>
</div>
<jsp:include page="../footer.jsp"/>
</body>
</html>